#include <QtGui/QBoxLayout>
#include <QtGui/QApplication>
#include <QtGui/QPushButton>
#include <QtGui/QDesktopWidget>
#include <QtGui/QVBoxLayout>
#include <QtCore/QDebug>

#include "MainWindow.h"

MainWindow::MainWindow(QWidget *parent):QWidget(parent)
{
    initUI();

    connect(m_recoverWidget, SIGNAL(nextPage()), this, SLOT(showDonePage()));
}

MainWindow::~MainWindow()
{
}

void MainWindow::initUI()
{
    QDesktopWidget *desktop = QApplication::desktop();
    int desktopWidth = desktop->width();
    int desktopHeight = desktop->height();

    setFixedSize(300, 200);
    move((desktopWidth - width())/2, (desktopHeight - height())/2);

    setWindowTitle(tr("iSoft Instant Recovery"));
    setWindowIcon(QIcon(QLatin1String(":/image/logo.png")));

    QVBoxLayout *mainLayout = new QVBoxLayout;

    m_stackedWidget = new QStackedWidget(this);
    m_recoverWidget = new RecoverWidget(this);
    m_doneWidget = new DoneWidget(this);

    m_stackedWidget->addWidget(m_recoverWidget);
    m_stackedWidget->addWidget(m_doneWidget);

    mainLayout->addWidget(m_stackedWidget);

    setLayout(mainLayout);

    m_stackedWidget->setCurrentWidget(m_recoverWidget);
}

void MainWindow::showDonePage()
{
    m_stackedWidget->setCurrentWidget(m_doneWidget);
}
